<?php
// Admin组下面的所有Action的父类
class BaseAction extends Action {
	
	//控制器初始化 或 权限控制  或 其他
	function _initialize() {
		//判断后台是否登录，如果未登录，跳转到登录页，并阻止后续操作
		$admin = session("admin");
		if(!$admin){	//后台未登录
			redirect(__APP__."/center/login/");
			return;
		}
		
		$cid = $this->_get("cid");
		$cid = CommonUtil::parseInt($cid);
		if($cid != 0){
			$catalog = CatalogHelper::getObject("catalog_id={$cid}");
			$location = CatalogHelper::getLocation4Admin($catalog);	//当前位置
			$this->assign("location",$location);
		}
		$config = WebConfigHelper::getObject();	//系统配置数据
		
		$this->assign("config",$config);
		$this->assign("admin_title","4JCMS后台管理系统");
		$this->assign("admin_name",$admin["admin_name"]);
		$catalogList = CatalogHelper::getList("pid=0","order_num DESC");
		$subCatalogList = CatalogHelper::getList("pid<>0","order_num DESC");
		$this->assign("catalogList",$catalogList);
		$this->assign("subCatalogList",$subCatalogList);
		
	}

}